$(document).ready(function(){
	var index = 1;
	$("#addline").click(function() {
		var $datatable = $("#datatable tr");
		var len=$datatable.length;
		var lenid=1;
		var newline = "<tr align='center' bgcolor='#FFFFFF' height='22' id='appendId"+index+"'>"
			+"<td><input width='100%' type='checkbox' id='selectedList' name='selectedList' value='"+index+"' class='np'></td>"
			+"<td><input width='100%' type='text' class='tdinput' border='0' "+"name='commoditys["+index+"].commodity_name' /></td>"
			+"<td ><input width='100%' type='text' class='tdinput' "+"name='sellBackDetails["+index+"].quantity' /></td>";
		//alert("newline:"+newline);
		//var currentRow=$('#datatable:first tbody tr:eq('+len+')');
		$("#datatable").append(newline);
	    index++;
	});
	$("#removeline").click(function() {
		var i = index - 1;
		//var $datatable = $("#datatable tr");
		//var len=$datatable.length;
		//var currentRow=$('#datatable:first tbody tr:eq('+len+')');
		if(index>=2){
			$("#appendId"+i).remove();
			index--;
		}
	});
});

